<?php
/**
* @version		$Id: weblink.php 10079 2008-02-28 13:39:08Z ircmaxell $
* @package		Joomla
* @subpackage	JA News
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
* Janews templates Table class
*
* @package		Joomla
* @subpackage	JA News
* @since 1.0
*/

class TableJanews_templates extends JTable
{
	/** @var int Primary key */
	var $id	= 0;
	/** @var string */
	var $template	= '';
	/** @var string */
	var $title	= '';
	/** @var string */
	var $type	= '';
	/** @var string */
	var $params = '';

	/**
	 * Constructor
	 *
	 * @param object Database connector object
	 * @since 1.0
	 */
	function __construct(& $db) {
		parent::__construct('#__janews_templates', 'id', $db);
	}

	// overloaded delete function
	function delete( $oid=null )
	{
		$k = $this->_tbl_key;
		if ( $oid ) {
			$this->$k = intval( $oid );
		}
		if ( parent::delete( $oid ))
		{
			$query = 'DELETE FROM #__janews_templates'
			. ' WHERE id = '.(int) $this->$k;
			
			$this->_db->setQuery( $query );
			if ( !$this->_db->query() ) {
				$this->_error .= $this->_db->getErrorMsg() . "\n";
			}
			return true;
		}

		return false;
	}
}
